<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    <title>pvsmaska</title>
    <link rel="stylesheet" type="text/css" href="csound.css" />
    <meta name="generator" content="DocBook XSL Stylesheets V1.78.1" />
    <link rel="home" href="index.html" title="The Canonical Csound Reference Manual" />
    <link rel="up" href="OpcodesTop.html" title="Orchestra Opcodes and Operators" />
    <link rel="prev" href="pvslock.html" title="pvslock" />
    <link rel="next" href="pvsmix.html" title="pvsmix" />
  </head>
  <body>
    <div class="navheader">
      <table width="100%" summary="Navigation header">
        <tr>
          <th colspan="3" align="center">pvsmaska</th>
        </tr>
        <tr>
          <td width="20%" align="left"><a accesskey="p" href="pvslock.html">Prev</a> </td>
          <th width="60%" align="center">Orchestra Opcodes and Operators</th>
          <td width="20%" align="right"> <a accesskey="n" href="pvsmix.html">Next</a></td>
        </tr>
      </table>
      <hr />
    </div>
    <div class="refentry">
      <a id="pvsmaska"></a>
      <div class="titlepage"></div>
      <a id="IndexPvsmaska" class="indexterm"></a>
      <div class="refnamediv">
        <h2>
          <span class="refentrytitle">pvsmaska</span>
        </h2>
        <p>pvsmaska — 
      Modify amplitudes using a function table, with dynamic scaling.
    </p>
      </div>
      <div class="refsect1">
        <a id="idp139305296"></a>
        <h2>Description</h2>
        <p>
      Modify amplitudes of fsrc using  function table, with dynamic scaling.
    </p>
      </div>
      <div class="refsect1">
        <a id="idp139306576"></a>
        <h2>Syntax</h2>
        <pre class="synopsis">fsig <span class="command"><strong>pvsmaska</strong></span> fsrc, ifn, kdepth</pre>
      </div>
      <div class="refsect1">
        <a id="idp139308784"></a>
        <h2>Initialization</h2>
        <p>
      <span class="emphasis"><em>ifn</em></span> -- The f-table to use. Given fsrc has N analysis bins, table ifn must be of size N or larger. The table need not be normalized, but values should lie within the range 0 to 1. It can be supplied from the score in the usual way, or from within the orchestra by using <a class="link" href="pvsinfo.html" title="pvsinfo"><em class="citetitle">pvsinfo</em></a> to find the size of fsrc, (returned by pvsinfo in inbins), which can then be passed to ftgen to create the f-table.
    </p>
      </div>
      <div class="refsect1">
        <a id="idp139374416"></a>
        <h2>Performance</h2>
        <p>
      <span class="emphasis"><em>kdepth</em></span> -- Controls the degree of modification applied to fsrc, using simple linear scaling. 0 leaves amplitudes unchanged, 1 applies the full profile of ifn.
    </p>
        <p>
      Note that power-of-two FFT sizes are particularly convenient when using table-based processing, as the number of analysis bins (inbins) is then a power-of-two plus one, for which an exactly matching f-table can be created. In this case it is important that the f-table be created with a size of inbins, rather than as a power of two, as the latter will copy the first table value to the guard point, which is inappropriate for this opcode.
    </p>
        <div class="warning" style="margin-left: 0.5in; margin-right: 0.5in;">
          <table border="0" summary="Warning">
            <tr>
              <td rowspan="2" align="center" valign="top" width="25">
                <img alt="[Warning]" src="images/warning.png" />
              </td>
              <th align="left">Warning</th>
            </tr>
            <tr>
              <td align="left" valign="top">
                <p>
        It is unsafe to use the same f-variable for both input and output of pvs opcodes. Using the same one might lead to undefined behavior on some opcodes. Use a different one on the left and right sides of the opcode.
      </p>
              </td>
            </tr>
          </table>
        </div>
      </div>
      <div class="refsect1">
        <a id="idp139378048"></a>
        <h2>Examples</h2>
        <p>
      Here is an example of the use of the <span class="emphasis"><em>pvsmaska</em></span> opcode. It uses the file <a class="ulink" href="examples/pvsmaska.csd" target="_top"><em class="citetitle">pvsmaska.csd</em></a>.
      </p>
        <div class="example">
          <a id="idp139380352"></a>
          <p class="title">
            <strong>Example 703. Example of the <span class="emphasis"><em>pvsmaska</em></span> opcode.</strong>
          </p>
          <div class="example-contents">
            <p>See the sections <a class="link" href="UsingRealTime.html" title="Real-Time Audio"><em class="citetitle">Real-time Audio</em></a> and <a class="link" href="CommandFlags.html" title="Csound command line"><em class="citetitle">Command Line Flags</em></a> for more information on using command line flags.</p>
            <pre class="programlisting">
<span class="csdtag">&lt;CsoundSynthesizer&gt;</span>
<span class="csdtag">&lt;CsOptions&gt;</span>
-odac
<span class="csdtag">&lt;/CsOptions&gt;</span>
<span class="csdtag">&lt;CsInstruments&gt;</span>

<span class="ohdr">sr</span> <span class="op">=</span> 44100
<span class="ohdr">ksmps</span> <span class="op">=</span> 16
<span class="ohdr">nchnls</span> <span class="op">=</span> 1
<span class="ohdr">0dbfs</span> <span class="op">=</span> 1

<span class="comment">;; example written by joachim heintz 2009</span>

<span class="comment">; function table for defining amplitude peaks (from the example of Richard Dobson)</span>
giTab		<span class="ohdr">ftgen</span>		0, 0, 513, 8, 0, 2, 1, 3, 0, 4, 1, 6, 0, 10, 1, 12, 0, 16, 1, 32, 0, 1, 0, 436, 0

<span class="oblock">instr</span> 1
imod		<span class="op">=</span>		p4<span class="comment">; degree of midification (0-1)</span>
ifftsize	<span class="op">=</span>		1024
ioverlap	<span class="op">=</span>		ifftsize <span class="op">/</span> 4
iwinsize	<span class="op">=</span>		ifftsize
iwinshape	<span class="op">=</span>		1<span class="comment">; von-Hann window</span>
Sfile		<span class="op">=</span>		"fox.wav"
ain		<span class="opc">soundin</span>	Sfile
fftin		<span class="opc">pvsanal</span>	ain, ifftsize, ioverlap, iwinsize, iwinshape<span class="comment">; fft-analysis of file</span>
fmask		<span class="opc">pvsmaska</span>  	fftin, giTab, imod
aout		<span class="opc">pvsynth</span>	fmask<span class="comment">; resynthesize</span>
		<span class="opc">out</span>		aout
<span class="oblock">endin</span>

<span class="csdtag">&lt;/CsInstruments&gt;</span>
<span class="csdtag">&lt;CsScore&gt;</span>
<span class="stamnt">i</span> 1 0 2.757 0 
<span class="stamnt">i</span> 1 3 2.757 1
<span class="stamnt">e</span>
<span class="csdtag">&lt;/CsScore&gt;</span>
<span class="csdtag">&lt;/CsoundSynthesizer&gt;</span>
</pre>
          </div>
        </div>
        <p><br class="example-break" />
    </p>
      </div>
      <div class="refsect1">
        <a id="idp139385072"></a>
        <h2>See Also</h2>
        <p>
      <a class="link" href="pvsanal.html" title="pvsanal"><em class="citetitle">pvsanal</em></a>,
      <a class="link" href="pvsynth.html" title="pvsynth"><em class="citetitle">pvsynth</em></a>,
      <a class="link" href="pvsadsyn.html" title="pvsadsyn"><em class="citetitle">pvsadsyn</em></a>
    </p>
      </div>
      <div class="refsect1">
        <a id="idp139389040"></a>
        <h2>Credits</h2>
        <p>
      </p>
        <table border="0" summary="Simple list" class="simplelist">
          <tr>
            <td>Author: Richard Dobson</td>
          </tr>
          <tr>
            <td>August 2001 </td>
          </tr>
        </table>
        <p>
    </p>
        <p>New in version 4.13</p>
      </div>
    </div>
    <div class="navfooter">
      <hr />
      <table width="100%" summary="Navigation footer">
        <tr>
          <td width="40%" align="left"><a accesskey="p" href="pvslock.html">Prev</a> </td>
          <td width="20%" align="center">
            <a accesskey="u" href="OpcodesTop.html">Up</a>
          </td>
          <td width="40%" align="right"> <a accesskey="n" href="pvsmix.html">Next</a></td>
        </tr>
        <tr>
          <td width="40%" align="left" valign="top">pvslock </td>
          <td width="20%" align="center">
            <a accesskey="h" href="index.html">Home</a>
          </td>
          <td width="40%" align="right" valign="top"> pvsmix</td>
        </tr>
      </table>
    </div>
  </body>
</html>
